<!--
 * @Author: zhangxiangsheng 1026583651@qq.com
 * @Date: 2024-06-18 13:57:45
 * @LastEditors: zhangxiangsheng 1026583651@qq.com
 * @LastEditTime: 2024-06-26 09:01:26
 * @FilePath: \appGly\pages\Station\Stationedt.vue
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <view>
    <u-navbar title="站点查看"></u-navbar>
    <formz ref="formz" :inputs="inputs" :data="data"></formz>
    <fixedbtn>
      <u-button type="primary" @click="save" :loading="loading">
        {{ $z.$t("保存数据") }}
      </u-button>
    </fixedbtn>
  </view>
</template>

<script>
  import json from "./Stationaddjson.js";
  export default {
    data() {
      return {
        inputs: json.addjson,
        loading: false,
        query: {},
        data: {},
      };
    },
    onLoad(query) {
      this.query = query;
      this.init();
    },
    methods: {
      async init() {
        await this.$store.dispatch("user/getuser");
        let StationCar = await this.$z.request("/StationCar", {
          id: this.query.id,
        });
        let Station = await this.$z.request("/Station", {
          id: this.query.id,
        });
        this.data = {
          ...Station[0],
          ...StationCar[0],
        };
      },
      async save() {
        let data = await this.$refs.formz.validate();
        data.b_car = "1";
        this.loading = true;
        await this.$z.request("/Stationedt", data);
        await this.$z.request("/StationCaredt", {
          ...data,
        });
        this.loading = false;
        this.$z.back();
      },
    },
  };
</script>

<style></style>
